<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>object example</h1>
	<script>
		function Member()/*Member class정의*/
		{
			/*필드를 정의할 때는 반드시 this를 사용해야 함*/
			this.irum='kyun';
			this.age=18;
			this.address='seoul';
			this.score=90;
			/*setter 정의 자바와 비슷한 방법*/
			this.setIrum = function(v)
			{
				this.irum=v;
			}
			this.setAge = function(v)
			{
				this.age=v;
			}
			this.setAddress = function(v)
			{
				this.address=v;
			}
			this.setScore = function(v)
			{
				this.score=v;
			}
			/*getter 정의 자바와 비슷한 방법*/
			this.getIrum=function()
			{
				return this.irum;
			}
			this.getAge=function()
			{
				return this.age;
			}
			this.getAddress=function()
			{
				return this.address;
			}
			this.getScore=function()
			{
				return this.score;
			}
			
		}
		/*getter/setter 정의 자바와는 조금다름*/
		
		
		var m=new Member();
		document.write(m.irum);
		
		m.setIrum('kim');
		document.write("<br/> new irum : "+m.getIrum());
		
	</script>
</body>
</html>















